cmake_minimum_required(VERSION 3.15)
project(path_follower)

# Set to Release in order to speed up the program significantly
set(CMAKE_BUILD_TYPE Release) #None, Debug, Release, RelWithDebInfo, MinSizeRel

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(control_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(nav2_msgs REQUIRED)
find_package(gazebo_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(visualization_msgs)

find_package(yaml-cpp REQUIRED)

file(GLOB_RECURSE SRCS "src/*.cpp")

include_directories(${CMAKE_SOURCE_DIR}
                    ${CMAKE_SOURCE_DIR}/src
                    )

add_executable(path_follower ${SRCS})
ament_target_dependencies(path_follower rclcpp_action rclcpp tf2_ros visualization_msgs nav2_msgs gazebo_msgs 
                          std_msgs sensor_msgs geometry_msgs control_msgs nav_msgs)
# link yaml-cpp
target_link_libraries(path_follower yaml-cpp)

target_compile_definitions(path_follower PRIVATE CMAKE_LISTS_DIR="${CMAKE_SOURCE_DIR}")

install(
  DIRECTORY launch
  DESTINATION share/${PROJECT_NAME}/
)

install(
  DIRECTORY config
  DESTINATION share/${PROJECT_NAME}/
)

install(
  DIRECTORY urdf
  DESTINATION share/${PROJECT_NAME}/
)

install(
  DIRECTORY rviz
  DESTINATION share/${PROJECT_NAME}/
)

install(
  DIRECTORY worlds
  DESTINATION share/${PROJECT_NAME}/
)

install(
  TARGETS path_follower
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()